# -*- coding:utf-8 -*-

'''

使用flask搭建服务器

'''


from Req_Person import *
from Req_Info import *
from flask import Flask, request, render_template

# app
app = Flask(__name__)


# route /
@app.route('/', methods=['GET', 'POST'])
def home():
    return render_template('home.html')

# imagelist
@app.route('/static/map/', methods=['GET'])
def imagelist():
    uid = request.args.get('uid')
    return render_template('map.html', uid=str(uid))

# route /note
@app.route('/datanote', methods=['GET', 'POST'])
def note():
    username = request.form['username']
    person_info = GetPersonInfoFromScreenName(username.encode('utf-8'))
    CreateWordCloudMap(username.encode('utf-8'), './bg/love.jpg') # page is 6
    return render_template('home.html', isInfo=True, person_info=person_info)


if __name__ == '__main__':
    app.run(port=8000)
